Skip to content

fix: redirect logged-out users when clicking Follow on testimony#2063

Open
saschabuehrle wants to merge 1 commit intocodeforboston:mainfrom
saschabuehrle:fix/issue-2059
Open

fix: redirect logged-out users when clicking Follow on testimony#2063
saschabuehrle wants to merge 1 commit intocodeforboston:mainfrom
saschabuehrle:fix/issue-2059

Conversation

@saschabuehrle
Copy link

Bug

Issue #2059 reports that logged-out users can click the Follow button on a testimony page, but nothing happens.

Fix

This PR updates BaseFollowButton to redirect unauthenticated users to the login page when they click follow/unfollow.

  • uses router.push('/login?redirect=...') with the current path
  • keeps the existing follow/unfollow behavior unchanged for authenticated users

This makes the button behavior consistent with the rest of the app’s auth-protected flows.

Testing

  • YARN_IGNORE_ENGINES=1 yarn check-types
  • YARN_IGNORE_ENGINES=1 ./node_modules/.bin/eslint components/shared/FollowButton.tsx

Happy to address any feedback.

Greetings, saschabuehrle

@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
maple-dev Ready Ready Preview, Comment Mar 13, 2026 7:18am

Request Review

Copy link
Collaborator

@Mephistic Mephistic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up!

Does this work for you locally? When I test this on the Vercel staging environment (e.g. https://maple-8x4dayz4v-maple-testimony.vercel.app/testimony/JEzCsV1OiC9hwCyrcON5A/1 ) when logged out, it does not redirect and I see an error: Uncaught (in promise) FirebaseError: Missing or insufficient permissions.

I think this is because we actually have two different Follow button components - the one modified in this PR, and the one on the Testimony Detail page the bug happens for. It looks like the follow actions here are defined in the TestimonyDetailPage component and passed as props to the PolicyActions component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants